package org.liuyuantao;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.liuyuantao.entity.User;
import org.liuyuantao.util.FreeMarkerUtil;

import freemarker.template.Template;
import freemarker.template.TemplateException;

public class ConsoleMain {

	public static void main(String[] args) {
		User user = new User();
		user.setName("tom");

		Template template = FreeMarkerUtil.getTemplate("console.ftl");
		Map<String, Object> root = new HashMap<>();
		root.put("lastUpdated", new Date());
		root.put("user", user);
		Writer out = new OutputStreamWriter(System.out);
		try {
			template.process(root, out);
		} catch (TemplateException | IOException e) {
			e.printStackTrace();
		}
	}

}
